package com.work;
public class work_01 {

    public static void main(String[] args) {
	//使用二维数组存储班上五个学生三门功课的考试成绩，要求输出每一个学生的总分、平均分、最高分、最低分
        int[][] scores = {
                {69,78,89},
                {88,76,70},
                {90,90,66},
                {100,89,87},
                {84,79,64}
        };
        double totalScore, avgScore, maxScore, minScore;
        totalScore = avgScore = maxScore = minScore = 0;
        for (int i = 0; i < scores.length; i++) {
            for (int j = 0; j < scores[i].length; j++) {
                totalScore += scores[i][j];
                maxScore = minScore = scores[i][0];
                if (scores[i][j] > maxScore) {
                    maxScore = scores[i][j];
                }
                if (scores[i][j] < minScore) {
                    minScore = scores[i][j];
                }
            }
            avgScore = totalScore / scores[i].length;
            System.out.println("第" + (i + 1) + "位学生的总分为：" + totalScore + ",平均分为：" +
                    String.format("%.2f", avgScore) + ",最高分为：" + maxScore + ",最低分为：" + minScore);
            totalScore = 0;
            avgScore = 0;
        }
    }
}
